﻿using System;
using System.ComponentModel.Composition;
using System.Linq;
using FinMkts.DataProvider.Internal;
using FinMkts.Messaging;

namespace FinMkts.Prices.ConsoleClient
{
    class PricesConsoleClient
    {
        [Import]
        public Subscriber Subscriber { get; set; }

        [Import]
        public InternalPriceSerializer PriceSerializer { get; set; }

        public void Start()
        {
            Subscriber.Start();

            var prices = from message in Subscriber
                         select PriceSerializer.Deserialize(message.Body);

            prices.Subscribe(Console.WriteLine);

        }
    }
}